import React from 'react';
import PropTypes from 'prop-types';
import {
    Menu, Dropdown, Icon, Button
} from 'antd'

// 组件本身
const ListRowTools = ({
                          row,
                          onEdit,
                          onDelete,
                          onUp,
                          onDown,
                          onMove
                      }) => {
    // console.log('----------------------------');
    // console.log('row', row);
    // console.log('----------------------------');
    const menu = (
        <Menu>
            <Menu.Item>
                <a className="ant-dropdown-link">
                    编辑 <Icon type="edit"/>
                </a>
            </Menu.Item>
            <Menu.Item>
                <a className="ant-dropdown-link">
                    删除 <Icon type="close"/>
                </a>
            </Menu.Item>
            <Menu.Item>
                <a className="ant-dropdown-link">
                    上移 <Icon type="arrow-up"/>
                </a>
            </Menu.Item>
            <Menu.Item>
                <a className="ant-dropdown-link">
                    下移 <Icon type="arrow-down"/>
                </a>
            </Menu.Item>
            <Menu.Item>
                <a className="ant-dropdown-link">
                    移动 <Icon type="arrows-alt"/>
                </a>
            </Menu.Item>
        </Menu>
    );

    return (
        <Dropdown overlay={menu}>
            <a className="ant-dropdown-link" href="#">
                操作 <Icon type="down"/>
            </a>
        </Dropdown>
    )
}

// 组件属性验证
ListRowTools.propTypes = {
    row: PropTypes.object,//List内每行的数据
    onEdit: PropTypes.func,//编辑
    onDelete: PropTypes.func,//删除
    onUp: PropTypes.func,//上移
    onDown: PropTypes.func,//下移
    onMove: PropTypes.func,//移动
}

export default ListRowTools;
// export default Form.create()(ListRowTools);